;; `ls' don't mind, we certainly do, because it makes us think
;; there is no wildcard, only a directory name.
(if (and ls-lisp-support-shell-wildcards
- (string-match "[[?*]" file))
+ (string-match "[[?*]" file)
+ ;; Prefer an existing directory to wildcards, like
+ ;; dired-noselect does.
+ (not (file-directory-p file)))
(progn
(or (not (eq (aref file (1- (length file))) ?/))
(setq file (substring file 0 (1- (length file)))))